package com.zjk.service.impl;

import com.github.pagehelper.PageHelper;
import com.zjk.dao.MemberMapper;
import com.zjk.pojo.Member;
import com.zjk.pojo.SysUser;
import com.zjk.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MemberService implements IMemberService {
    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member getMemberNyMembernameAndPwd(Member member) {
        Member member1 = memberMapper.getMemberNyMemberNameAndPwd(member);
        return member1;
    }

    @Override
    public List<Member> getAllMembers(String name, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Member> allMembers = memberMapper.getAllMembers(name);
        return allMembers;
    }

    @Override
    public Member getMemberById(Integer id) {
        Member member = memberMapper.getMemberById(id);
        return member;
    }

    @Override
    public int addMember(Member member) {
        int i = memberMapper.addMember(member);
        return i;
    }

    @Override
    public int editMember(Member member) {
        int i = memberMapper.editMember(member);
        return i;
    }

    @Override
    public int delById(Integer id) {
        int i = memberMapper.delById(id);
        return i;
    }

    @Override
    public int delAll(List<Integer> ids) {
        int i = memberMapper.delAll(ids);
        return i;
    }

    @Override
    public Member getMemberByMemberName(String name) {
        Member member= memberMapper.getMemberByMemberName(name);
        return member;
    }
}
